get average of numbers in array javascript